<template>
    <div class="facilitator_enterprise_list_add">
        <div class="header">
            <div class="header_title cp" :class="{active: baseInfo}" @click="changTitle(1)" >基本信息</div>
            <!-- <div class="header_title cp" :class="{active: contract}" @click="changTitle(2)" >签约设置</div> -->
        </div>
        <div class="content">
            <!-- 基本信息 -->
            <enterprise-base v-show="baseInfo" :reset="reset"  :type=1 @submitBaseInfo="submitBaseInfo" ></enterprise-base>

            <!-- 签约设置 -->
            <!-- <enterprise-contract v-show="contract"  :type=1 :add_enterprise_id="add_enterprise_id" ></enterprise-contract> -->
        </div>
    </div>
</template>

<script>
    import EnterpriseBase from 'components/businessManagement/child_component/enterprise_base';
    import EnterpriseContract from 'components/businessManagement/child_component/enterprise_contract';
    import EnterpriseAccount from 'components/businessManagement/child_component/enterprise_account';


export default {
    name:"FacilitatorEnterpriseListAdd",
    components: {
        EnterpriseBase,
        EnterpriseContract,
        EnterpriseAccount
    },
    data(){
          return {
              baseInfo: true,           //基本信息是否显示（默认点击查看企业时，基本信息默认展开显示）
              contract: false,          //签约设置信息是否显示
              current_path: '',         //当前路由
              reset: false,             //是否重新进来
              add_enterprise_id: 0      //针对新增企业基本信息之后，返回回来的企业ID   
          }
    },
    mounted(){
        this.$setRouteTitle();
        this.current_path = this.$route.path;

    },
    computed:{
        getNavList() {
            return this.$store.getters.getNavList;
        }
    },
    activated(){
        let flag = false;
        for(let val of this.getNavList){
            if(val.path == this.current_path){
                flag = true;
            }
        }
        if(!flag){
            this.$setRouteTitle();
            this.reset = true;
        }
    },
    deactivated(){
        let flag = false;    //是否保留数据
        for(let val of this.getNavList){
            if(val.path == this.current_path){
                flag = true;
            }
        }
        if(!flag){
            this.reset = false;
        }
    },
    methods:{
        submitBaseInfo(enterprise_id){          //现在新增也跳回首页了，编辑协议费率只在企业协议费率列表中进行修改
            /*
            this.add_enterprise_id = enterprise_id;
            this.baseInfo = false;
            this.contract = true;
            */
            this.$message.success('新增成功');
            let that = this;
            setTimeout(function() {
                that.$blackRoute({ path: '/facilitator_enterprise_list',query:{},that:this});                 // 返回指定路由-删除标题栏
            }, 500);
        },
        changTitle(val){
             if(val==1){
                  this.baseInfo=true;
                  this.contract=false;
             }else{
                   this.baseInfo=false;
                  this.contract=true;                 
             }
        }
    }
}
</script>

<style lang="less" :scope="true" >
    .facilitator_enterprise_list_add{
        margin: 10px;
        padding:0 10px;
        font-size: 14px;
        background: #fff;

        .active{
            color: #4280f2;
            border-bottom: 2px solid #4280f2
        }

        .header{
            display: inline-block;
            margin:10px auto;
            width: 100%;
            border-bottom: 1px solid #e0e0e0;

            .header_title{
                width: 70px;
                height: 50px;
                margin: 0 10px;
                line-height: 50px;
                text-align: center;
                float: left;
                
            }
        }

        .content{
            margin: 10px;
        }

    }

</style>>